"use strict";

/**
 * 教室相关接口调用
 */
import Ajax from "../libs/ajax";

//导入教室
// export function importClassroom(data) {
//     return Ajax.ajax({
//         url: '/api/classroom/import_classroom',
//         method: 'post',
//         data: data
//     }).then(res => res.data)
// }

// 
export function getClassroom(query) {
    if (query.page_num === undefined || query.page_size === undefined) {
        return new Promise((resolve, reject) => {
            resolve({ code: 2011, msg: "教室查询参数缺失" });
        });
    }
    return Ajax.ajax({
        url: "/api/classroom/query",
        method: "post",
        data: query
    }).then(res => res.data);
}

export function addClassroom(data) {
    return Ajax.ajax({
        url: "/api/classroom/add",
        data: data,
        method: "post"
    }).then(res => res.data);
}

export function updateClassroom(data) {
    return Ajax.ajax({
        url: "/api/classroom/update",
        data: data,
        method: "post"
    }).then(res => res.data);
}

export function deleteClassroom(data) {
    return Ajax.ajax({
        url: "/api/classroom/delete",
        data: data,
        method: "post"
    }).then(res => res.data);
}